﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style x:Key="TextBoxBase" TargetType="{x:Type TextBox}">
        <Setter Property="FontFamily" Value="SimHei" />
        <!-- Define the ErrorTemplate in order to remove the default error visual feedback, the red border. -->
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <AdornedElementPlaceholder />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip">
                    <Setter.Value>
                        <ToolTip DataContext="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget}">
                            <Grid Width="300">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <StackPanel Orientation="Horizontal" Background="DarkGray">
                                    <Image Source="/Skins/Resource/Image/Info.png" Margin="2" Height="24" Width="24" />
                                    <TextBlock Text="发生了什么？" TextWrapping="Wrap" FontSize="20" Padding="5" Foreground="White" FontWeight="Bold" />
                                </StackPanel>
                                <TextBlock Grid.Row="1" Padding="5" FontSize="20" Text="{Binding (Validation.Errors).CurrentItem.ErrorContent}" TextWrapping="Wrap" />
                            </Grid>
                        </ToolTip>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="InfoTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBase}">
        <Setter Property="FontSize" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border x:Name="Container" BorderThickness="1" BorderBrush="#a7a7a7" Background="#dbe1ee" CornerRadius="4">
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="1" Opacity="0.6" />
                        </Border.Effect>
                        <ScrollViewer x:Name="PART_ContentHost"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Container" Property="Background" Value="White" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Container" Property="Background" Value="DarkGray" />
                        </Trigger>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter TargetName="Container" Property="Background" Value="DarkGray" />
                        </Trigger>
                        <Trigger Property="AcceptsReturn" Value="False">
                            <Setter Property="VerticalContentAlignment" Value="Center" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="Container" Property="Background" Value="#f7f753" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RegularTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBase}">
        <Setter Property="FontSize" Value="16" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
    </Style>
</ResourceDictionary>